﻿using System;
using System.Net;
using System.Xml.Linq;
using System.Linq;

namespace ArmoryBrowser.Entities
{
    public class CharacterInfo
    {
        #region Fields
        private Character _characterField;
        private CharacterTab _characterTabField;
        private Summary _summaryField;
        #endregion
        #region Properties
        public Character Character
        {
            get
            {
                return this._characterField;
            }
            set
            {
                this._characterField = value;
            }
        }

        public CharacterTab CharacterTab
        {
            get
            {
                return this._characterTabField;
            }
            set
            {
                this._characterTabField = value;
            }
        }

        public Summary Summary
        {
            get
            {
                return this._summaryField;
            }
            set
            {
                this._summaryField = value;
            }
        }
        #endregion
        #region Constructor
        public CharacterInfo(XElement element)
        {
            Character = element.Elements("character").Select(e => new Character(e)).FirstOrDefault();
            CharacterTab = element.Elements("characterTab").Select(e=> new CharacterTab(e)).FirstOrDefault();
            Summary = element.Elements("summary").Select(e => new Summary(e)).FirstOrDefault();
        }
        #endregion
    }
}
